package com.chinamoney.wppm.controller;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.chinamoney.wppm.service.BdmService;
import com.chinamoney.wppm.util.ResultMessage;

@RestController
public class BdmController {

	@Autowired
	private BdmService bdmService;

	/**
	 * 获取部门的需求变更单花费
	 * @param deptName
	 * @return
	 */
	@GetMapping("bdm/dc/{name}")
	public ResultMessage<?> getDemandChangeCost(@PathVariable("name") String name) {
		return bdmService.getDemandChangeCost(name);
	}
	
	/**
	 * 根绝ID获取部门预算
	 * @param id
	 * @return
	 */
	@GetMapping("bdm/{id}")
	public ResultMessage<?> getBdmById(@PathVariable("id") String id) {
		return bdmService.getBdmById(id);
	}
	
	/**
	 * 获取各部门的预算情况（条件年度）
	 * @param year
	 * @return
	 */
	@GetMapping("bdm/list/budget/{year}")
	List<Map<String, Object>> getBdmInDeptByYear(@PathVariable("year") String year) {
		return bdmService.getBdmInDeptByYear(year);
	}
	
	/**
	 *  电子需求单获取部门预算管理
	 * @param parent
	 * @param limit
	 * @param offset
	 * @return
	 */
	@GetMapping("bdm")
	public ResultMessage<?> getBdm(Integer limit, Integer offset) {
		return bdmService.getBdms(offset, limit);
	}
	
	/**
	 *  部门预算情况
	 * @param dept
	 * @return
	 */
	@GetMapping("bdm/echart")
	public Map<String, Object> getBdmByDept(String dept) {
		return bdmService.getBdmByDept(dept);
	}
	
}
